package com.demo.mvc.ioc;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;


@Slf4j
public class People004   {

  Animal animal;
  ApplicationContext applicationContext;

//  @Autowired
//  public void setAnimal(  @Qualifier("dogImpl") Animal aAnimal){
//    animal = aAnimal;
//  }

    @Autowired
  public void setAnimal(Animal[] animals){
      for(Animal animal : animals){
        log.info("test123,{}", animal.getClass());
        if (animal.getClass().getName().equals(CatImpl.class.getName()) ){
          this.animal= animal;
          break;
        }
      }
  }

  public void myAnimalSay(){
    animal.say();
  }

}
